package com.etc.dao;

import com.etc.entity.SysOrder;
import com.etc.entity.SysOrderExample;
import com.etc.entity.SysOrderKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface SysOrderMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int countByExample(SysOrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int deleteByExample(SysOrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    @Delete({
        "delete from sys_order",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(SysOrderKey key);

    List<SysOrder> findByAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    @Insert({
        "insert into sys_order (id, order_no, ",
        "user_id, number, ",
        "clean_mode, payment, ",
        "remarks, order_date, ",
        "pick, name, phone, ",
        "addr, status)",
        "values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{userId,jdbcType=INTEGER}, #{number,jdbcType=VARCHAR}, ",
        "#{cleanMode,jdbcType=VARCHAR}, #{payment,jdbcType=VARCHAR}, ",
        "#{remarks,jdbcType=VARCHAR}, #{orderDate,jdbcType=VARCHAR}, ",
        "#{pick,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, ",
        "#{addr,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(SysOrder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int insertSelective(SysOrder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    List<SysOrder> selectByExample(SysOrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, order_no, user_id, number, clean_mode, payment, remarks, order_date, pick, ",
        "name, phone, addr, status",
        "from sys_order",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    SysOrder selectByPrimaryKey(SysOrderKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") SysOrder record, @Param("example") SysOrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") SysOrder record, @Param("example") SysOrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(SysOrder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order
     *
     * @mbggenerated
     */
    @Update({
        "update sys_order",
        "set order_no = #{orderNo,jdbcType=VARCHAR},",
          "user_id = #{userId,jdbcType=INTEGER},",
          "number = #{number,jdbcType=VARCHAR},",
          "clean_mode = #{cleanMode,jdbcType=VARCHAR},",
          "payment = #{payment,jdbcType=VARCHAR},",
          "remarks = #{remarks,jdbcType=VARCHAR},",
          "order_date = #{orderDate,jdbcType=VARCHAR},",
          "pick = #{pick,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR},",
          "phone = #{phone,jdbcType=VARCHAR},",
          "addr = #{addr,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysOrder record);
}